Repository navigation
Load Composer's autoloader when installed as a dependency - #879
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Firehed
marked this pull request as ready for review
October 28, 2026 19:37
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #879 +/- ##
=========================================
Coverage 99.64% 99.64%
Complexity 1969 1969
=========================================
Files 145 145
Lines 4513 4513
=========================================
Hits 4497 4497
Misses 16 16 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #723.
When the package is installed as a dependency,
bin/php-lspruns fromvendor/firehed/php-lsp/bin/, and its hard-coded../vendor/autoload.phpdoes not exist there, so the server fails before it starts.For a PHP executable a package declares, Composer's
vendor/binlauncher sets$GLOBALS['_composer_autoload_path']to the project's autoloader before running it (seeComposer\Installer\BinaryInstaller::generateUnixyProxyCode; Windows launchers run the same PHP launcher). The executable now uses that path when it is set, and falls back to its own../vendor/autoload.phpwhen run directly, as in this checkout and the end-to-end tests. PHPUnit's executable does the same.Testing
The root-project route is covered by the existing end-to-end tests, which start
bin/php-lspdirectly.The dependency route has no automated test; #878 tracks adding one in CI. It was verified by hand: a scratch project required this branch through a Composer path repository (copied, not symlinked), with the copied package's own
vendor/moved aside, as a published package would have none.vendor/bin/php-lspansweredinitializewith the fix, and failed on the missingvendor/autoload.phpwith the old line restored.🤖 Generated with Claude Code